package com.liang.config;

import com.liang.mall.util.ResultEntity;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created with IntelliJ IDEA.
 * User: XIAOLIANG
 * Date: 2021/5/7
 * Time: 18:28
 * Description: No Description 全局异常处理
 */
//@ControllerAdvice
//@ResponseBody
public class GlobalExceptionHandler {


    @ExceptionHandler(value = Exception.class)
    public ResultEntity defaultException(Exception e){

        System.out.println("异常原因:"+e);

        return ResultEntity.error(e.getMessage());

    }


}
